
//
//  OrderGoodsCell.m
//  LuxuryGoods
//
//  Created by DCQ on 2018/5/23.
//  Copyright © 2018年 Future. All rights reserved.
//

#import "OrderGoodsCell.h"
#import "LGImageManagerIO.h"
@interface OrderGoodsCell()
@property (weak, nonatomic) IBOutlet UIButton *btn;
@property(nonatomic, assign) OrderGoodsButtonStyle  style;
@end
@implementation OrderGoodsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self setupView];
}
- (void)setupView{
    UIImage * btnImgNor = [LGImageManagerIO createGradualColorImage:self.btn.size startColor:UIColorFromRGB(0xE1CFA9) endColor:UIColorFromRGB(0xC1B284)];
    
    [self.btn setBackgroundImage:btnImgNor forState:UIControlStateNormal];
    self.btn.layer.shadowOffset =  CGSizeMake(5,5);
    self.btn.layer.shadowOpacity = 0.7;
    self.btn.layer.shadowColor =  UIColorFromRGB(0xC1B284).CGColor;
     [self.btn addTarget:self action:@selector(addButtonAction) forControlEvents:UIControlEventTouchUpInside];
 
}

- (void)setupOrderGooodsButtonStyle:(OrderGoodsButtonStyle)style{
    NSString * btnTitle = @"";
    switch (style) {
        case OrderGoodsButtonStyle_sell:
            self.btn.hidden = YES;
            break;
        case OrderGoodsButtonStyle_waitSend:
            btnTitle = @"填写寄件";
            break;
        case OrderGoodsButtonStyle_waitOffer:
            self.btn.hidden = YES;
            break;
        case OrderGoodsButtonStyle_waitPayment:
            btnTitle = @"立即付款";
            break;
        case OrderGoodsButtonStyle_waitComments:
            btnTitle = @"立即评价";
            break;
        case OrderGoodsButtonStyle_waitMaintain:
            btnTitle = @"查看物流";
            break;
        case OrderGoodsButtonStyle_waitIdentifier:
            btnTitle = @"查看物流";
            break;
            
        case OrderGoodsButtonStyle_send:
            self.btn.hidden = NO;
            btnTitle = @"查看物流";
            break;
        case OrderGoodsButtonStyle_offer:
            self.btn.hidden = NO;
            btnTitle = @"填写寄件";
    
           
            break;
       
        case OrderGoodsButtonStyle_complete:
            self.btn.hidden = YES;
            break;
            
        default:
            break;
    }
    
    [self.btn setTitle:btnTitle forState:UIControlStateNormal];
}


- (void)addButtonAction{
    if (self.buttonBlock) {
        self.buttonBlock(self.style);
    }
}




- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
